#include<iostream>
#include<vector>
#include<algorithm>

using std::vector;
using std::pair;
using std::make_pair;
using std::swap;
using std::cin;
using std::cout;
using std::iter_swap;

template<typename T>
pair<T, T> Partition(T left, T right, int mid) {
    while (left <= right) {
        while (*left < mid)
            ++left;
        while (*right > mid)
            --right;
        if (left <= right) {
            iter_swap(left, right);
            ++left;
            --right;
        }
    }
    auto res = make_pair(left, right);
    return res;
}

template<typename T>
void QuickSort(vector<T> &v, int left, int right) {
    if (left >= right) {
        return;
    }
    int mid = v[left + (std::rand() % (right - left))];
    pair<vector<int>::iterator, vector<int>::iterator>
        help = Partition(v.begin() + left, v.begin() + right, mid);

    auto less = distance(v.begin() + left, help.second);
    auto larger_or_equal = distance(v.begin() + left, help.first);
    QuickSort(v, left, left + less);
    QuickSort(v, left + larger_or_equal, right);
}

template<typename T>
void Input(vector<T> &v) {
    size_t n;

    cin >> n;
    v.resize(n);
    for (size_t i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

template<typename T>
void Output(vector<T> &v) {
    for (auto elem : v) {
        cout << elem << " ";
    }
}

int main() {
    vector<int> v;

    Input(v);
    QuickSort(v, 0, v.size() - 1);
    Output(v);
}
